<div class="box journal-carousel carousel-product <?php echo $hide_on_mobile_class; ?> <?php echo $show_title_class; ?>" id="carousel-<?php echo $module; ?>" style="<?php echo isset($css) ? $css : ''; ?>">
    <?php if ($show_title): ?>
    <div class="htabs box-heading <?php echo $single_class; ?>">
        <?php $index=0; foreach ($sections as $section): ?>
        <a href="#carousel-<?php echo $module; ?>-<?php echo $index; ?>"><?php echo $section['section_name']; ?></a>
        <?php $index++; endforeach; ?>
    </div>
    <?php endif; ?>
    <?php $index=0; foreach ($sections as $section): ?>
    <div id="carousel-<?php echo $module; ?>-<?php echo $index; ?>" class="owl-carousel tab-content box-content">
        <?php foreach ($section['items'] as $product) { ?>
        <div class="product-grid-item display-<?php echo $this->journal2->settings->get('product_grid_wishlist_icon_display');?> <?php echo $this->journal2->settings->get('product_grid_button_block_button');?>">
            <div class="product-wrapper">
                <?php if (isset($product['thumb'])) { ?>
                <div class="image">
                    <a href="<?php echo $product['href']; ?>" <?php if(isset($product['thumb2']) && $product['thumb2']): ?> class="has-second-image" style="background: url('<?php echo $product['thumb2']; ?>') no-repeat;" <?php endif; ?>>
                        <img class="first-image" width="<?php echo $image_width; ?>" height="<?php echo $image_height; ?>"  src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" />
                    </a>
                    <?php foreach ($product['labels'] as $label => $name): ?>
                    <?php if ($label === 'outofstock'): ?>
                    <img class="outofstock" style="position: absolute; top: 0; left: 0" src="<?php echo Journal2Utils::generateRibbon($name, $this->journal2->settings->get('out_of_stock_ribbon_size'), $this->journal2->settings->get('out_of_stock_font_color'), $this->journal2->settings->get('out_of_stock_bg')); ?>" alt="" />
                    <?php else: ?>
                    <span class="label-<?php echo $label; ?>"><b><?php echo $name; ?></b></span>
                    <?php endif; ?>
                    <?php endforeach; ?>
                    <?php if($this->journal2->settings->get('product_grid_wishlist_icon_position') === 'image' && $this->journal2->settings->get('product_grid_wishlist_icon_display', '') === 'icon'): ?>
                        <div class="wishlist"><a onclick="addToWishList('<?php echo $product['product_id']; ?>');" class="hint--top" data-hint="<?php echo $button_wishlist; ?>"><i class="wishlist-icon"></i><span class="button-wishlist-text"><?php echo $button_wishlist;?></span></a></div>
                        <div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');" class="hint--top" data-hint="<?php echo $button_compare; ?>"><i class="compare-icon"></i><span class="button-compare-text"><?php echo $button_compare;?></span></a></div>
                    <?php endif; ?>
                </div>
                <?php } ?>
                <div class="product-details">
                    <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
                    <div class="description"><?php echo $product['description']; ?></div>
                    <?php if ($product['price']) { ?>
                    <div class="price">
                        <?php if (!$product['special']) { ?>
                        <?php echo $product['price']; ?>
                        <?php } else { ?>
                        <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
                        <?php } ?>
                        <?php if ($product['tax']) { ?>
                        <hr>
                        <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
                        <?php } ?>
                    </div>
                    <?php } ?>
                    <?php if ($product['rating']) { ?>
                    <div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
                    <?php } ?>
                    <hr>
                    <div class="cart">
                        <a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button hint--top" data-hint="<?php echo $button_cart; ?>"><i class="button-left-icon"></i><span class="button-cart-text"><?php echo $button_cart; ?></span><i class="button-right-icon"></i></a>
                    </div>
                    <div class="wishlist"><a onclick="addToWishList('<?php echo $product['product_id']; ?>');" class="hint--top" data-hint="<?php echo $button_wishlist; ?>"><i class="wishlist-icon"></i><span class="button-wishlist-text"><?php echo $button_wishlist;?></span></a></div>
                    <div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');" class="hint--top" data-hint="<?php echo $button_compare; ?>"><i class="compare-icon"></i><span class="button-compare-text"><?php echo $button_compare;?></span></a></div>
                </div>
            </div>
        </div>
        <?php } ?>
    </div>
    <?php $index++; endforeach; ?>

    <script>
        (function(){
            var opts = $.parseJSON('<?php echo json_encode($grid); ?>');

            jQuery110("#carousel-<?php echo $module; ?> .owl-carousel").owlCarousel({
                itemsCustom: opts,
                autoPlay: <?php echo $autoplay ? $autoplay : 'false'; ?>,
                touchDrag: <?php echo $touch_drag ? 'true' : 'false'; ?>,
                stopOnHover: <?php echo $pause_on_hover ? 'true' : 'false'; ?>,
                items: 15,
                navigation: true,
                scrollPerPage: true,
                navigationText: false,
                slideSpeed: <?php echo $slide_speed; ?>,
                margin: 20
            });

            <?php if ($arrows === 'side'): ?>
            $('#carousel-<?php echo $module; ?> .owl-buttons').addClass('side-buttons');
            <?php endif; ?>

            <?php if ($arrows === 'none'): ?>
            $('#carousel-<?php echo $module; ?> .owl-buttons').hide();
            <?php endif; ?>

            <?php if (!$bullets): ?>
            $('#carousel-<?php echo $module; ?> .owl-pagination').hide();
            <?php endif; ?>

            $('#carousel-<?php echo $module; ?> .htabs a').tabs();

            <?php if ($autoplay): ?>
            $('#carousel-<?php echo $module; ?> .htabs a').click(function () {
                var current = $(this).attr('href');
                $('#carousel-<?php echo $module; ?> .htabs a').each(function () {
                    var href = $(this).attr('href');
                    if (current === href) {
                        jQuery110(href).data('owlCarousel').play();
                    } else {
                        jQuery110(href).data('owlCarousel').stop();
                    }
                });
            });
            <?php endif; ?>

            Journal.equalHeight($('#carousel-<?php echo $module; ?> .product-grid-item'), '.name');

            var default_section = '<?php echo $default_section; ?>';
            if (default_section) {
                $('#carousel-<?php echo $module; ?> .htabs a[href="#carousel-<?php echo $module; ?>-' + default_section + '"]').click();
            } else {
                $('#carousel-<?php echo $module; ?> .htabs a').first().click();
            }
        })();
    </script>
</div>
